// 检测一个数是否是素数
function isPrime(number) {
  if (number < 2) return false;
  for (let i = 2; i < number; i++) {
    if (number % 2 === 0) return false;
  }
  return true;
}

let isPrimeProxy = new Proxy(isPrime, {
  apply: (target, thisArg, args) => {
    console.time('isPrime');
    const result = target.apply(thisArg, args);
    console.timeEnd('isPrime');
    return result;
  },
});

isPrimeProxy(1299827);
